<?php

class Father {

    public function getNewFather() {
        return new self();
    }

    public function getNewCaller() {
        return new static();
    }

}

$f = new Father();

print get_class($f->getNewFather()) . "\n" ;
print get_class($f->getNewCaller()) . "\n";

class Sun1 extends Father {

	public function test()
	{
		return 'sun1 test';
	}
}

class Sun2 extends Father {
	public function test()
	{
		return 'sun2 test';
	}
}

$sun1 = new Sun1();
$sun2 = new Sun2();

print get_class($sun1->getNewFather()) . "\n";
print $sun1->getNewCaller()->test() . "\n";   // run1 test
print get_class($sun2->getNewFather()) . "\n";
print get_class($sun2->getNewCaller()) . "\n";